﻿<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/Main.master" CodeBehind="Default.aspx.cs" Inherits="StockCrawler._Default" %>

<%@ Register assembly="DevExpress.Web.v14.2, Version=14.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Data.Linq" tagprefix="dx" %>


<asp:Content ID="Content" ContentPlaceHolderID="MainContent" runat="server">
    <script type="text/javascript">
        var order;
        function onSorting(s, e) {
            order = order == "ASC" ? "DESC" : "ASC";
            e.cancel = true;
            s.PerformCallback("SORT|" + e.column.fieldName + "|" + order);
        }

        function getPaging() {
            detailGridView.PerformCallback("PAGING");
        }

        function getIndex(s, e) {
            if (typeof (detailGridView) != 'undefined' && e.visibleIndex != -1)
                detailGridView.PerformCallback("INDEX|" + e.visibleIndex);
        }
    </script>
    <dx:ASPxSplitter ID="ASPxSplitter2" runat="server" Height="100%">
        <Styles>
            <Pane>
                <Paddings Padding="0px" />
            </Pane>
        </Styles>
        <Panes>
            <dx:SplitterPane MinSize="600px" Name="stockContainer" ShowCollapseBackwardButton="True">
                <ContentCollection>
                    <dx:SplitterContentControl runat="server">
                        <dx:ASPxGridView ID="ASPxGridView1" Width="100%"  KeyFieldName="id_stock" runat="server" DataSourceID="LinqServerModeDataSourceStock" AutoGenerateColumns="False" OnDataBound="ASPxGridView1_DataBound" >
                             <ClientSideEvents  SelectionChanged="getIndex" EndCallback="getPaging"/>
                             <Settings VerticalScrollBarMode="Visible" VerticalScrollableHeight="390" />
                                    <border borderwidth="0px"></border>
                            <Columns>
                                <dx:GridViewDataTextColumn Caption="ID" FieldName="id_stock" ShowInCustomizationForm="True" Visible="False" VisibleIndex="0">
                                </dx:GridViewDataTextColumn>
                                <dx:GridViewDataTextColumn Caption="Mã CK" FieldName="code" ShowInCustomizationForm="True" VisibleIndex="1" Width="50px">
                                </dx:GridViewDataTextColumn>
                                <dx:GridViewDataTextColumn Caption="Công ty" FieldName="name" ShowInCustomizationForm="True" VisibleIndex="3" Width="250px">
                                </dx:GridViewDataTextColumn>
                                <dx:GridViewDataTextColumn FieldName="eps" ReadOnly="True" VisibleIndex="4">
                                </dx:GridViewDataTextColumn>
                                <dx:GridViewDataTextColumn FieldName="pe" ReadOnly="True" VisibleIndex="5">
                                </dx:GridViewDataTextColumn>
                                <dx:GridViewDataTextColumn FieldName="bv" ReadOnly="True" VisibleIndex="6">
                                </dx:GridViewDataTextColumn>
                                <dx:GridViewDataTextColumn FieldName="klcp_niemyet" ReadOnly="True" VisibleIndex="7">
                                </dx:GridViewDataTextColumn>
                                <dx:GridViewDataTextColumn FieldName="klcp_luuhanh" ReadOnly="True" VisibleIndex="8">
                                </dx:GridViewDataTextColumn>
                                <dx:GridViewDataTextColumn FieldName="vcsh" ReadOnly="True" VisibleIndex="9">
                                </dx:GridViewDataTextColumn>
                            </Columns>
                            <SettingsBehavior ProcessFocusedRowChangedOnServer="True" AllowSelectByRowClick="True" AllowSelectSingleRowOnly="True" />
                            <SettingsPager PageSize="20">
                                <PageSizeItemSettings Items="20, 50, 100" Visible="True">
                                </PageSizeItemSettings>
                            </SettingsPager>
                            <Settings ShowFilterRow="True" ShowFilterRowMenu="True" ShowFooter="True"/>
                        </dx:ASPxGridView>
                        <dx:LinqServerModeDataSource ID="LinqServerModeDataSourceStock" runat="server" ContextTypeName="StockCrawlerLib.StockDataClassesDataContext" TableName="stocks" />
                    </dx:SplitterContentControl>
                </ContentCollection>
            </dx:SplitterPane>
            <dx:SplitterPane MinSize="350px">
                <ContentCollection>
                    <dx:SplitterContentControl runat="server">
                        <dx:ASPxGridView ID="ASPxGridView2" ClientInstanceName="detailGridView" Width="100%" runat="server" AutoGenerateColumns="false" KeyFieldName="id_stock" OnCustomCallback="ASPxGridView2_CustomCallback" OnHtmlDataCellPrepared="ASPxGridView2_HtmlDataCellPrepared">
        <Columns>
            <dx:GridViewDataDateColumn FieldName="stockexchange_name" Visible="false" VisibleIndex="1" Width="90" Caption="Ngày GD" SortOrder="Descending" >
            </dx:GridViewDataDateColumn>
            <dx:GridViewDataDateColumn FieldName="ngay_giao_dich" VisibleIndex="1" Width="90" Caption="Ngày GD" SortOrder="Descending" >
            </dx:GridViewDataDateColumn>
            <dx:GridViewDataTextColumn FieldName="gia_dong_cua" VisibleIndex="2" Width="90" Caption="Đóng cửa">
                <PropertiesTextEdit DisplayFormatString="#,###.0"/>
            </dx:GridViewDataTextColumn>
            <dx:GridViewDataTextColumn FieldName="thay_doi" VisibleIndex="3" Width="100" Caption="Thay đổi (%)">
                <PropertiesTextEdit DisplayFormatString="#0.0"/>
            </dx:GridViewDataTextColumn>
            <dx:GridViewDataTextColumn FieldName="gia_tham_chieu" VisibleIndex="4" Width="100" Caption="Tham chiếu">
                <PropertiesTextEdit DisplayFormatString="#,###.0"/>
            </dx:GridViewDataTextColumn>
            <dx:GridViewDataTextColumn FieldName="gia_mo_cua" VisibleIndex="5" Width="90" Caption="Mở cửa">
                <PropertiesTextEdit DisplayFormatString="#,###.0"/>
            </dx:GridViewDataTextColumn>
            <dx:GridViewDataTextColumn FieldName="gia_cao_nhat" VisibleIndex="6" Width="90" Caption="Cao nhất">
                <PropertiesTextEdit DisplayFormatString="#,###.0"/>
            </dx:GridViewDataTextColumn>
            <dx:GridViewDataTextColumn FieldName="gia_thap_nhat" VisibleIndex="7" Width="90" Caption="Thấp nhất">
                <PropertiesTextEdit DisplayFormatString="#,###.0"/>
            </dx:GridViewDataTextColumn>
            <dx:GridViewDataTextColumn FieldName="klgd_khop_lenh" VisibleIndex="8" Width="70" Caption="KLGD">
                <PropertiesTextEdit DisplayFormatString="#,###"/>
            </dx:GridViewDataTextColumn>
            <dx:GridViewDataTextColumn FieldName="gtgd_khop_lenh" VisibleIndex="9" Width="120" Caption="GTGD">
                <PropertiesTextEdit DisplayFormatString="#,###"/>
            </dx:GridViewDataTextColumn>
            <dx:GridViewDataTextColumn FieldName="so_lenh_mua" VisibleIndex="14" Width="100" Caption="Lệnh mua">
                <PropertiesTextEdit DisplayFormatString="#,###"/>
            </dx:GridViewDataTextColumn>
            <dx:GridViewDataTextColumn FieldName="kl_dat_mua" VisibleIndex="15" Width="100" Caption="KL đặt mua">
                <PropertiesTextEdit DisplayFormatString="#,###"/>
            </dx:GridViewDataTextColumn>
            <dx:GridViewDataTextColumn FieldName="so_lenh_ban" VisibleIndex="16" Width="100" Caption="Lệnh bán">
                <PropertiesTextEdit DisplayFormatString="#,###"/>
            </dx:GridViewDataTextColumn>
            <dx:GridViewDataTextColumn FieldName="kl_dat_ban" VisibleIndex="17" Width="100" Caption="KL đặt bán">
                <PropertiesTextEdit DisplayFormatString="#,###"/>
            </dx:GridViewDataTextColumn>
        </Columns>
                            <ClientSideEvents ColumnSorting="onSorting" />

        <SettingsBehavior AllowSelectByRowClick="true" />
                            
                            <%--<Settings VerticalScrollBarMode="Auto" HorizontalScrollBarMode="Auto" VerticalScrollableHeight="440" />
                            <SettingsPager PageSize="50">
                                <PageSizeItemSettings Items="50, 100" Visible="True"/>
                            </SettingsPager>--%>

                            <Settings VerticalScrollBarMode="Auto" HorizontalScrollBarMode="Auto" VerticalScrollableHeight="470" />
                            <SettingsPager Mode="ShowAllRecords"/>
            
    </dx:ASPxGridView>
                    </dx:SplitterContentControl>
                </ContentCollection>
            </dx:SplitterPane>
        </Panes>
    </dx:ASPxSplitter>
    
</asp:Content>

